package com.neu.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neu.po.ResponseResult;
import com.neu.service.RoommanageService;
import com.neu.po.Roommanage;
@RestController
@RequestMapping("Roommanage")
public class RommanageController {
  @Autowired
  private RoommanageService rommanageService;
  
  @RequestMapping("update")
	public ResponseResult update(@RequestBody Roommanage rommanage) {
		ResponseResult result = new ResponseResult();
		result.setData(rommanageService.update(rommanage));
		
		return result;
	}
	
	@RequestMapping("delete")
	public ResponseResult delete(int id) {
		ResponseResult result = new ResponseResult();
		result.setData(rommanageService.delete(id));
		
		return result;
	}
	
	@RequestMapping("insert")
	public ResponseResult insert(@RequestBody Roommanage rommanage) {
		ResponseResult result = new ResponseResult();
		rommanage.setDelmark(1);
		result.setData(rommanageService.insert(rommanage));
		
		return result;
	}
	
	@RequestMapping("getAllRoom")
	public ResponseResult getAllRoom() {
		ResponseResult result = new ResponseResult();
		result.setData(rommanageService.getAllRoom());
		
		return result;
	}
	
	@RequestMapping("getPagedRoom")
	public ResponseResult getPaged(int pageNum,int pageSize,String keyword) {
		ResponseResult result = new ResponseResult();
		result.setData(rommanageService.getPagedRoom(pageNum, pageSize,keyword));
		
		return result;
	}
   
	@RequestMapping("batchDeleteRoom")
	public ResponseResult batchDeleteRoom(@RequestBody List<Integer> ids) {
		ResponseResult result = new ResponseResult();
		result.setData(rommanageService.batchDeleteRoom(ids));
		
		return result;
	}
  
}
